<template>
  <form-create
    v-model="fapi"
    :rule="rule"
    :option="option"
     @submit="onSubmit"
  ></form-create>
</template>

<script>
import formCreate from "@form-create/element-ui";
//FcDesigner 生成的`JSON`
const FcDesignerRule = '[\n' +
  '    {\n' +
  '        "type": "upload",\n' +
  '        "field": "Foq561elroub0",\n' +
  '        "title": "上传",\n' +
  '        "info": "",\n' +
  '        "$required": false,\n' +
  ' "on" :"{before-upload:function(){console.log(11111)}}"'+
  '        "props": {\n' +
  '            "action": "https://hncxsk.oss-cn-shenzhen.aliyuncs.com/",\n' +
  '            "name": "file"\n' +
  '        },\n' +
  '        "_fc_drag_tag": "upload",\n' +
  '        "hidden": false,\n' +
  '        "display": true\n' +
  '    }\n' +
  ']';

//FcDesigner 生成的`options`
const FcDesignerOptions = '{"form": {\n' +
  '        "labelPosition": "right",\n' +
  '        "size": "mini",\n' +
  '        "labelWidth": "125px",\n' +
  '        "hideRequiredAsterisk": false,\n' +
  '        "showMessage": true,\n' +
  '        "inlineMessage": false\n' +
  '    },\n' +
  '    "submitBtn": true,\n' +
  '    "resetBtn": false\n' +
  '}';

export default {
  data() {
    return {
      fapi: null,
      rule: formCreate.parseJson(FcDesignerRule),
      option: formCreate.parseJson(FcDesignerOptions)
    }
  },
  methods: {
    onSubmit(formData) {
      //todo 提交表单
    }
  }
}
</script>

<style scoped>

</style>
